banner

Functions 05

OPENING QUESTION: The following function is a, well, good try at trying to check errors on user input.

  1. What type of function is this?
  2. How do you know?
  3. Take a moment to see what this function is TRYING to do.
  4. Then please have a conversation and document several ways in which this function could be improved.

Advanced question: Even with some work this function will still frustrate users if they type in their phone # like this: 555-1234. Why is that?

5. Please rereate that function and then work with your group to improve on it.

LEARNING TARGET: I will practice coding functions during today's class.

I will be able to import and/or change my sprite's costumes during today's class.

WORDS O' THE DAY:

  • Parameter
  • Argument

WORK O' THE DAY:

We'll be working on programming a Pong game shortly. Please take a few moments to search the 'costume' options in SNAP for the image of a small ball (I *think* you can import your own objects but that's a bit more convoluted).

Take a few moments to take that new costumed sprite and put it in a loop of some sort and have it move around the screen. Get a flavor for how much time between movements makes the ball move the smoothest.

Then fire up a new SNAP program and import that image as a new 'costume' for one of your sprites.

Then do the same thing for a Pong 'paddle' (Many students find it easier just to go ahead and make their own paddle using the 'paint your own costume' option in SNAP) You are welcome to do that or 'borrow' one from someone else in your group if you like!

NOTE: You can also import an image from your computer by dragging it into the 'costume' tab in SNAP

It's time for PONG!!!

Let's take a look at the program requirements... Please read those carefully and see if there are any questions, comments or concerns (I'll be glad to re-write the specs as needed!)

═══════════════════════════